<?php
$log_name = Q::ini('custom_system/access_log_dir') . date('Y-m-d');
if (CURRENT_USER_ID)
{
	$user = CURRENT_USER_NAME;
}
else
{
	$user = '-';
}
$log_data = date('H:i:s') . ' ' . $user . ' ' . $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'];
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$log_data .= ' ' . arrayToString($_POST);
}
$log_data .= PHP_EOL;
file_put_contents($log_name, $log_data, FILE_APPEND);

function arrayToString($arr)
{
	$string = 'array(';
	foreach ($arr as $k => $a)
	{
		$string .= $k . '=>';
		if (is_array($a))
		{
			$string .= arrayToString($a) . ',';
		}
		else
		{
			$string .= $a . ',';
		}
	}
	return $string . ')';
}
